package com.zprmb.udzt.activity;

import android.content.Intent;
import android.media.Image;
import android.os.Build;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.zprmb.udzt.BaseActivity;
import com.zprmb.udzt.R;

import java.lang.reflect.Method;

public class XianFengChongZhiActivity extends BaseActivity implements View.OnClickListener {

    RelativeLayout rl_back;
    ImageView img_back;

    TextView tv_title;

    Button btn_invest;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_xianfeng);
        setStatusBarIconDark(true);
        setImmersionStatus();
        rl_back = (RelativeLayout) findViewById(R.id.rl_back);
        img_back = (ImageView) findViewById(R.id.img_back);
        rl_back.setOnClickListener(this);
        img_back.setOnClickListener(this);
        tv_title = (TextView) findViewById(R.id.tv_title);
        tv_title.setText("充值");
        btn_invest = (Button) findViewById(R.id.btn_invest);
        btn_invest.setOnClickListener(this);

    }

    private void setImmersionStatus() {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
            // 透明状态栏
            getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
            // 透明导航栏
            //getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
        }
    }

    @Override
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.rl_back:
                finish();
                break;
            case R.id.img_back:
                finish();
                break;

        }
    }

    private void setStatusBarIconDark(boolean dark) {
        try {
            Object win = getWindow();
            Class<?> cls = win.getClass();
            Method method = cls.getDeclaredMethod("setStatusBarIconDark", boolean.class);
            method.invoke(win, dark);
        } catch (Exception e) {
            Log.e("ff", "statusBarIconDark,e=" + e);
        }
    }
}
